package com.sinodata.bsm.cicp.util.telnet;

import java.io.IOException;

/**
 * TelnetException类是一般化异常, 可以重新抛出持久性框架处理过程中产生的任何小问题.
 * 框架中其他特定的异常可以在使用Telnet的应用程序中跟踪和捕获. 这些异常扩展TelnetException, 包括:
 * <li>TelnetTaskTimeOutException</li>
 *
 * @author thomas.h.zhang
 */
public class TelnetException extends IOException {
    private static final long serialVersionUID = 264910066865506919L;
    protected Throwable exceptionCause = null;

    public TelnetException(String exceptionMsg) {
        super(exceptionMsg);
    }

    public TelnetException(String exceptionMsg, Throwable exceptionCause) {
        super(exceptionMsg);
        this.exceptionCause = exceptionCause;
    }

    public void printStackTrace() {
        if (exceptionCause != null) {
            System.err.println("An execption has been caused by: ");
            exceptionCause.printStackTrace();
        } else {
            System.err.println(this.getMessage());
        }
    }

}
